package com.example.po;

import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import lombok.Data;

import java.util.Date;

@Data
@TableName(value = "sys_server")
public class SysServer extends Model<SysServer> {

    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    //服务节点
    @TableField(value = "server_key")
    private Long serverKey;

    //服务IP
    @TableField(value = "ip")
    private String ip;

    //服务端口
    @TableField(value = "port")
    private String port;

    //刷新时间
    @TableField(value = "refresh_time")
    private Date refreshTime;

    //停机时间
    @TableField(value = "down_time", fill = FieldFill.UPDATE)
    private Date downTime;

    //激活状态
    @TableField(value = "is_active")
    private boolean isActive;

    public void recalculateFields() {
        this.refreshTime = new Date();
    }
}